﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Diagnostics.Contracts;
using EOS.Data;
using EOS.Data.Utils;
using EOS.OverviewSettings.Properties;

namespace EOS.OverviewSettings
{
    public class OverviewSettingsExporter
    {
        private readonly string _pathToXmlSettings;
        private readonly XDocument _doc;
        private EveOverview _eveOverview;
        private readonly EosBase _db;


        public OverviewSettingsExporter(string pathToXmlSettings)
        {
            Contract.Requires(!String.IsNullOrEmpty(pathToXmlSettings), 
                "pathToXmlSettings may not be null or empty.");

            _pathToXmlSettings = pathToXmlSettings;
            _doc = XDocument.Load(pathToXmlSettings);

            var connectionPool = new SqlceConnectionPool(Settings.Default.DBCnnString);

            //using (_db = new EosBase(connectionPool.Connection))
            //{
            //    ParseEveOverviewXml();
            //}
        }

        /// <summary>
        /// 
        /// </summary>
        public void Save()
        {
            // TODO: Export changes to XDocument 
            _doc.Save(_pathToXmlSettings);
        }
    }
}
